<table class="tablesorter">
                                		<thead>
                                			<tr>
                                            <?php
                                            	foreach($ads_overview_table_terms as $term_key=>$term_val){
                                            		//if(isset($online_ads_overview[0]->$term_key)){
                                            			echo '<th>'.$term_val['name'].'</th>';	
                                            		//}	
                                            	}
                                            ?>
                                			</tr>
                                		</thead>
										<tbody>
                                        <?php
                                        foreach ($online_ads_overview as $key=>$val) {
                                            echo '<tr>';
                                            foreach ($ads_overview_table_terms as $term_key=>$term_val) {
                                                if (isset($val->$term_key)) {
                                                    echo '<td id="'.$val->website.'_'.$val->ads.'_'.$term_key.'">'.($val->$term_key).'</td>';
                                                }
												else echo '<td style="text-align:center;"><img src="/images/public/get_code.png" alt="copy code" style="cursor:pointer;" onclick="getCode(\''.$val->website.'_'.$val->ads.'\')" />&nbsp;&nbsp;<img src="/images/public/edit_code.png" style="cursor:pointer;" alt="edit code" onclick="getUpdateAds(\''.$val->website.'_'.$val->ads.'\')" />&nbsp;&nbsp;<img src="/images/public/delete_code.gif" alt="delete code" style="cursor:pointer;" onclick="deleteAds(\''.$val->website.'\',\''.$val->ads.'\',\''.$val->ads_name.'\')" /></td>';
                                            }

                                            echo '</tr>';
                                        }
                                        ?>
										</tbody>
                                	</table>